package ptu.dao;

import org.apache.ibatis.annotations.*;
import ptu.entity.User;

import java.util.List;

@Mapper
public interface UserDao {
    @Select("select * from user")
    List<User> selectAll();

    @Select("select * from user where username=#{username}")
    User selectByUsername(String username);

    @Insert("insert into user values (0,#{username},#{password},#{major},#{sex},#{amount},'user')")
    int insert(User user);

    @Delete("delete from user where username=#{username}")
    int delete(String username);

    int update(User user);

    @Select("select * from user where id=#{id}")
    User selectById(Integer id);
}
